package com.tianhao.luo.nouse.v2.builder;

import com.tianhao.luo.nouse.v2.product.Product;

/**
 * @author tianhao.luo
 * @date 2019/12/11 14:28
 */
public class Builder {
    private String productName;
    private String companyName;
    private String part1;
    private String part2;
    private String part3;
    private String part4;

    public Builder() {
    }

    public Builder productName(String productName) {
        this.productName = productName;
        return this;
    }

    public Builder companyName(String companyName) {
        this.companyName = companyName;
        return this;
    }

    public Builder part1(String part1) {
        this.part1 = part1;
        return this;
    }

    public Builder part2(String part2) {
        this.part2 = part2;
        return this;
    }

    public Builder part3(String part3) {
        this.part3 = part3;
        return this;
    }

    public Builder part4(String part4) {
        this.part4 = part4;
        return this;
    }

    Product build() {
        // 校验对象是否创建....
        return new Product(this.productName,
                this.companyName,
                this.part1,
                this.part2,
                this.part3,
                this.part4);

    }
}
